package com.culturesalon.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.culturesalon.dao.CategoryDAO;
import com.culturesalon.dao.CategoryDAOImpl;
import com.culturesalon.dao.GoodsDAO;
import com.culturesalon.dao.GoodsDAOImpl;
import com.culturesalon.dao.NoticeCategoryDAO;
import com.culturesalon.dao.NoticeCategoryDAOImpl;
import com.culturesalon.dao.NoticeDAO;
import com.culturesalon.dao.NoticeDAOImpl;
import com.culturesalon.dto.Category;
import com.culturesalon.dto.Goods;
import com.culturesalon.dto.Notice;
import com.culturesalon.dto.NoticeCategory;
import com.culturesalon.dto.Page;
import com.culturesalon.util.NaviUtil;
import com.culturesalon.util.StringUtil;

/**
 * Servlet implementation class NoticeList
 */
@WebServlet("/noticelist.do")
public class NoticeList extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public NoticeList() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doPost(request,response);
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		request.setCharacterEncoding("UTF-8");
		NoticeDAO noticeDAO=new NoticeDAOImpl();
		List<Notice> listByCategory=noticeDAO.findAll();
		request.setAttribute("notice", listByCategory);
		request.setAttribute("mainpage", "noticelist.jsp");
		request.getRequestDispatcher("admin/adminindex.jsp").forward(request, response);
		
	}

}
